<template>
      <div id="skuChart" ref="spiderStat" style="height:400px;">xxx</div>
</template>
<script>
  export default {
    name: 'soldsChart',
    data() {
      return {
      }
    },
    mounted() {
      this.drawChart()
    },
    methods: {
      drawChart() {
        // 基于准备好的dom，初始化echarts实例
        console.log(this.$refs.spiderStat)
        let myChart = this.$echarts.init(document.getElementById("skuChart"))

        myChart.setOption({
          title: {
            text: '趋势图'
          },
          tooltip : {
            trigger: 'axis',
            axisPointer: {
              type: 'cross',
              label: {
                backgroundColor: '#65cea7'
              }
            }
          },
          toolbox: {
            feature: {
              saveAsImage: {}
            }
          },
          grid: {
            left: '5%',
            right: '5%',
            bottom: '5%',
          },
          xAxis : [
            {
              type : 'category',
              boundaryGap : false,
              data : [1,2,3,4,5]
            }
          ],
          yAxis : [
            {
              type : 'value'
            }
          ],
          series : [
            {
              type:'line',
              data:[10,20,53,24,55]
            }
          ]
        });
      }
    },
  }
</script>
